package com.example.xinyun.utils;

import com.lzy.imagepicker.loader.ImageLoader;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageSize;
import ohos.aafwk.ability.Ability;
import ohos.agp.components.Image;


public class UilImageLoader implements ImageLoader {

    @Override
    public void displayImage(Ability ability, String uriScheme, Image imageView, int width, int height) {
        // 设置options
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(true) // 是否开启内存缓存
                .cacheOnDisk(true) // 是否开启存储缓存
                .considerExifParams(true)
                .build();
        com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(uriScheme, imageView, options);
    }

    @Override
    public void displayImagePreview(Ability ability, String uriScheme, Image imageView, int width, int height) {
        ImageSize size = new ImageSize(width, height);
        com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(uriScheme, imageView, size);
    }

    @Override
    public void clearMemoryCache() {
    }
}